<template>
  <el-card class="page-tools">

    <el-row type="flex" class="navBar" align="middle" justify="space-between">
      <el-col>
        <div v-if="showBefore" class="before">
          <i class="el-icon-info" />
          <!-- 定义前面得插槽 -->
          <slot name="before" />
        </div>
      </el-col>
      <el-col>
        <el-row type="flex" justify="end">
          <slot name="after" />
        </el-row>
      </el-col>

    </el-row>
    <!-- 表格 -->
    <div class="content">
      <slot name="content" />
    </div>
  </el-card>
</template>

<script>
export default {
  // 父组件传的值,控制第一个插槽的显示与隐藏,左侧没有内容就隐藏
  props: {
    showBefore: {
      type: Boolean,
      default: false
    }
  }
}
</script>

<style lang="scss">
 .page-tools {
  margin: 0;
    .before {
      line-height: 34px;
    i {
      margin-right: 5px;
      color: #409eff;
    }
    display: inline-block;
    padding: 0px 10px;
    border-radius: 3px;
    border: 1px solid rgba(145, 213, 255, 1);
    background: rgba(230, 247, 255, 1);
  }
.content {
  margin-top: 20px;
}
 }
</style>
